<script type="text/javascript">
	function doSearchCmsNavigation(value) {
		
	}
	
	//表格查询  
	function reloadCmsNavigation() {
		var params = cmsNavigation_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		cmsNavigation_list.treegrid('reload'); //设置好查询参数 reload 一下就可以了  
		cmsNavigation_list.treegrid('unselectAll');
		cmsNavigation_list.treegrid('uncheckAll');
	}


	function addCmsNavigation() {
		createFromWindow("新增信息", "cmsNavigation.do?editCmsNavigation", "cmsNavigation.do?saveCmsNavigation",
				function(data) {
					reloadCmsNavigation();
				});
	}
	
	function deleteCmsNavigation() {
		var rows = cmsNavigation_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要删除吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('cmsNavigation.do?deleteCmsNavigationItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadCmsNavigation();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

	function editCmsNavigation() {
		var rows = cmsNavigation_list.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindow("编辑信息", "cmsNavigation.do?editCmsNavigation&cmsNavigationId=" + rows[0].id,
					"cmsNavigation.do?saveCmsNavigation", function(data) {
						reloadCmsNavigation();
					},true);
		} else {
			showMsg('请选择操作记录.');
		}

	}
	
	
	function clearCmsNavigationSearch() {
		setGridSearchParams('cmsNavigation_list','cmsNavigationSearchForm',true,reloadCmsNavigation);
	}
	
	//根据条件查询
	function cmsNavigationSearch() {
		setGridSearchParams('cmsNavigation_list','cmsNavigationSearchForm',false,reloadCmsNavigation);
	}
	
	function onDblClickCmsNavigationRow(rowData) {
		createFromWindow("编辑信息", "cmsNavigation.do?editCmsNavigation&cmsNavigationId=" + rowData.id,
					"cmsNavigation.do?saveCmsNavigation", function(data) {
						reloadCmsNavigation();
					},true);
	}
</script>


<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<@eu.treeGrid id="cmsNavigation_list" toolbar="#cmsNavigationlist_search" idField="id"  url="cmsNavigation.do?loadList" rownumbers="true" onDblClickRow="onDblClickCmsNavigationRow(rowData)"
			 item="com.xdtech.cms.vo.CmsNavigationItem"/>
		
		<div id="cmsNavigationlist_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="cmsNavigationSearchForm">
					<!-- 防止form表单里只有一个text元素时候，按enter键自动提交问题 -->
					<input style="display:none" />
					<table>
						<tr>
							<td>编码：</td>
							<td><input class="easyui-validatebox textbox" name="code" style="width: 150px"/></td>
							<td>名称：</td>
							<td><input class="easyui-validatebox textbox" name="name" style="width: 150px"/></td>
							<td>状态：</td>
							<td><input class="easyui-validatebox textbox" name="status" style="width: 150px"/></td>
							<td>
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="cmsNavigationSearch()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearCmsNavigationSearch()"/>
 					 		</td>
						</tr>
					</table>
				</form>
				
			</div>
			<div id="cmsNavigation_toolbar" style="height: auto">
				<@eu.linkbutton showName="新增" shiro="cms:cmsNavigation:add" iconCls="icon-add" onclick="addCmsNavigation()"/>
				<@eu.linkbutton showName="删除" shiro="cms:cmsNavigation:delete" iconCls="icon-remove" onclick="deleteCmsNavigation()"/>
				<@eu.linkbutton showName="编辑" shiro="cms:cmsNavigation:edit" iconCls="icon-edit" onclick="editCmsNavigation()"/>
				<@eu.linkbutton showName="刷新" shiro="cms:cmsNavigation:refresh" iconCls="icon-reload" onclick="reloadCmsNavigation()"/>
			</div>
		</div>
	</div>
</div>